<div class="row" ng-controller="adminListController">
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <form name="form" class="form-validation form-horizontal">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">{{admin.id?'修改':'增加'}}管理员信息</h4>
                </div>
                <div class="modal-body">
                    <!--修改-->
                    <div class="row" >
                        <div class="col-md-12">
                                <div class="form-group character-counter">
                                    <label class="control-label col-md-2">姓名</label>

                                    <div class="col-md-10">
                                        <input type="text" class="form-control" placeholder="请输入姓名" ng-model="admin.name" value="{{admin.name}}" maxlength="50" required/>
                                        <label class="character-counter-label-2" ng-bind="(admin.name != undefined ? admin.name.length : 0)+' / 50'">
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group character-counter">
                                    <label  class="control-label col-md-2">密码</label>
                                    <div class="col-md-10">
                                        <input type="password" class="form-control" placeholder="请输入密码" ng-model="admin.password" value="{{admin.password}}" maxlength="50" required/>
                                        <label class="character-counter-label-2" ng-bind="(admin.password != undefined ? admin.password.length : 0)+' / 50'">
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group character-counter">
                                    <label  class="control-label col-md-2">邮箱</label>
                                    <div class="col-md-10">
                                        <input type="text" class="form-control"  placeholder="请输入邮箱" ng-model="admin.email" value="{{admin.email}}" ng-pattern="/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/" maxlength="50" required/>
                                        <label class="character-counter-label-2" ng-bind="(admin.email != undefined ? admin.email.length : 0)+' / 50'">
                                        </label>
                                    </div>
                                </div>
                        </div>
                    </div>
                    <!--修改-->
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary"  ng-click="saveAdmin()" ng-disabled="form.$invalid" data-dismiss="modal">提交</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
                </div>
            </div>
                </form>
        </div>
    </div>
    <div class="col-md-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h1 class="panel-title">
                    管理员列表
                </h1>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-md-12">
                <table class="table table-hover table-cell table-bordered">
                    <thead>
                    <tr>
                        <th></th>
                        <th>姓名</th>
                        <th>密码</th>
                        <th>邮箱</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="admin in admins">
                        <td>{{$index+1}}</td>
                        <td>{{admin.name}}</td>
                        <td>{{admin.password}}</td>
                        <td>{{admin.email}}</td>
                        <td>
                            <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal" ng-click="updateAdmin(admin)">修改
                            </button>
                            <button class="btn btn-primary btn-sm" ng-click="deleteAdmin(admin.id,admin.name)">删除
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
                        </div>
                    </div>
            </div>
            <div class="panel-footer">
                <button type="button" class="btn btn-info " data-toggle="modal" data-target="#myModal" ng-click="addAdmin()">增加管理员</button>
                <a href="#/welcomePage" class="btn btn-info">返回首页</a>
            </div>
        </div>
    </div>
    <!-- Modal -->

</div>